Population statistics plots

Population statistics plots#

try to do some statistics on smarter samples

import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
import os
os.getcwd()
'/home/core/TSKITetude/docs/notebooks'

Define which chromosome to be plotted and the breed of interest. Also determine a second breed for comparisons. chr argument should be numeric

# import sys
# args = sys.argv
# chr=args[1]
# pop1=args[2]
# pop2=args[3]

# these are exmaple values. Must be changed!!!!
# 'LAT', 'CHR'
chr = 1
pop1 = 'LAT'
pop2 = 'CHR'
tajima = pd.DataFrame()

for chromosome in range(1, 2):
    tmp = pd.read_csv("WindowedTajima_" + str(chromosome) + ".csv")
    tmp.loc[:, "Chr"] = chromosome
    tajima = pd.concat([tajima, tmp])
plot = ggplot(data = tajima) + geom_line(aes(x = "Breakpoint", y = "TajimaD")) + \
    facet_wrap(facets = ["Chr", "Breed"], scales = "free") + ggtitle("TajimaD, remapped")
plot
ggsave(plot, "WindowedTajimaD_" + pop1 + ".png")
Fontconfig error: Cannot load default config file: No such file: (null)
'/home/core/TSKITetude/docs/notebooks/lets-plot-images/WindowedTajimaD_LAT.png'
# tajima not windowed
tajima = pd.read_csv("Tajima_" + str(chr) + ".csv")
plot = ggplot(data = tajima) + \
    geom_bar(aes(x = "Breed", y = "TajimaD"), stat = "identity") + \
        ggtitle(f"Chr{chr}'s TajimaD, not windowed")

plot
ggsave(plot, f"TajimaD_chr{chr}.png")
'/home/core/TSKITetude/docs/notebooks/lets-plot-images/TajimaD_chr1.png'